JavaScript

A5.ListBoxupdateRow Method

Syntax

A5.ListBox.updateRow(target,data)

Arguments

targetnumberstringobject

The index or value of the row to update in the list. See A5.ListBox.getIndex.

dataobject

The data to update the row with.

Description

Update a row in the list.

Discussion

The data used to update a row in the list can be sparse. Any values not included in the data object will be left at their current values. The value of the row will be updated to reflect any changes in the rows data.

Example

// To get a pointer to the A5.ListBox class see {dialog.object}.getControl
// assume lObj is a pointer to an instance of the A5.ListBox class
lObj.updateRow('ALFKI',{ContactName: 'Fred Thomas'}); // update the "ContactName" of the row with a value of "ALFKI"

Example: Updating Rows in a List Control

The following example demonstrates updating rows in a List Control in a UX Component.

var listObj = {dialog.object}.getControl('LIST1');

//update the 4th row (index is zero based)
listObj.updateRow(3,{firstname: 'John', lastname: 'Smith'});

//update the row for list primary key value of 'ALFKI' (List is configured to return the Primary Key)
listObj.updateRow('ALFKI',{firstname: 'John', lastname: 'Smith'});

Key values are always a string.

Field names are case sensitive.

The field names are case sensitive and must match the field name in the List control. For example, if the List field in the builder is named "FirstName", then the JavaScript to set the FirstName field using updateRow() must use the same case. EG:

var listObj = {dialog.object}.getControl('LIST1');

listObj.updateRow('ALFKI',{FirstName: 'Sydney'});

See Also